<template>
	<view class="page">
		<!-- Header -->
		<view class="headerBag">
			<image src="/static/icon-Get-into@3.png" class="back" @click="goBack"></image>
			<text class="font18 pagetitle">订单支付成功</text>
		</view>
		
		<!-- Content -->
		<view class="wrapper">
			<view class="showAmount font14">
				<text>支付方式 : </text>
				<text>{{ payType }}</text>
				<text class="break"></text>
				<text class="marginleft">支付金额 : </text>
				<text>{{ payTotal }}</text>
			</view>
			
			<view class="font17 tip" id="textReminder">
				{{ textReminder }}
			</view>
			
			<view class="submitBtn font17" @click="handleSubmit">
				返回
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				payType: '',
				payTotal: '',
				textReminder: '恭喜您购买云主身份成功',
				fromPage: ''
			}
		},
		onLoad(options) {
			// 获取页面参数
			this.payType = options.payType || '';
			this.payTotal = options.totalp || '';
			this.fromPage = options.from || '';
			
			// 根据参数设置提示文字
			if (options.added && options.added == 1) {
				this.textReminder = '恭喜您追加合伙人成功';
			} else if (options.added && options.added == 0) {
				this.textReminder = '恭喜您购买合伙人资质成功';
			}
			
			if (options.cityAgent && options.cityAgent == 0) {
				this.textReminder = '恭喜成为优享优品平台市运营';
			} else if (options.cityAgent && options.cityAgent == 1) {
				this.textReminder = '恭喜您追加市运营成功';
			}
			
			// 根据来源处理返回逻辑
			this.handleReturnLogic(options);
		},
		methods: {
			goBack() {
				uni.navigateBack();
			},
			handleSubmit() {
				uni.redirectTo({
					url: '/pages/identity/shenqing_more'
				});
			},
			handleReturnLogic(options) {
				if (options.from == 'myteam') {
					uni.showToast({
						title: '返回我的团队页面',
						duration: 1000
					});
					setTimeout(() => {
						uni.navigateBack({
							delta: 2
						});
					}, 1000);
				}
				
				if (options.from == 'queue') {
					if (options.cityAgent == 1) {
						// 追加市代理返回申请更多
						setTimeout(() => {
							uni.navigateBack({
								delta: 3
							});
						}, 1000);
					} else if (options.cityAgent == 0) {
						// 追加市代理返回申请更多页面
						uni.setStorageSync('gotoQueue', 'yes');
						setTimeout(() => {
							uni.navigateBack({
								delta: 4
							});
						}, 1000);
					}
				}
			}
		}
	}
</script>

<style scoped>
	.page {
		min-height: 100vh;
		background-color: #f5f5f5;
	}
	
	.headerBag {
		display: flex;
		align-items: center;
		padding: 20rpx 30rpx;
		background-color: #fff;
		border-bottom: 1rpx solid #eee;
		position: relative;
	}
	
	.back {
		width: 40rpx;
		height: 40rpx;
	}
	
	.pagetitle {
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
		font-size: 36rpx;
		font-weight: 500;
	}
	
	.wrapper {
		padding: 0 30rpx;
	}
	
	.showAmount {
		background: url('/static/wancheng@2x.png') no-repeat center left;
		background-size: 95rpx 95rpx;
		background-position-x: 102rpx;
		width: 100%;
		height: 95rpx;
		text-align: left;
		text-indent: 237rpx;
		line-height: 47.5rpx;
		margin-top: 124rpx;
		border: none;
		color: #4b4b4b;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}
	
	.break {
		height: 10rpx;
	}
	
	.marginleft {
		margin-left: 237rpx;
	}
	
	.font14 {
		font-size: 28rpx;
	}
	
	.font17 {
		font-size: 34rpx;
	}
	
	.font18 {
		font-size: 36rpx;
	}
	
	.tip {
		text-align: center;
		margin-top: 20rpx;
	}
	
	.submitBtn {
		height: 90rpx;
		width: 689rpx;
		line-height: 90rpx;
		text-align: center;
		background: #ff2e00;
		color: white;
		margin: 0 auto;
		border-radius: 20rpx;
		margin-top: 195rpx;
	}
	
	.redtip {
		color: #ff2e00;
	}
</style>